package cn.cy.domain.Const;

import cn.cy.domain.DTO.ResultDTO;
import org.json.JSONObject;


import java.util.HashMap;

/**
 * @Author: Xucranger
 * @Date: 22/5/2 9:23
 * @Des:用于存放各种回复变量
 */

public class ResponseConst {
    private static HashMap<String, ResultDTO> responseconst = new HashMap<String, ResultDTO>();
    static {
        responseconst.put("success",new ResultDTO(200,"操作成功",true));
        responseconst.put("fail",new ResultDTO(400,"操作失败",false));
        responseconst.put("connectTimeout",new ResultDTO(300,"连接超时",false));
    }


    public ResultDTO getByKey(String key){
        return responseconst.get(key);
    }


    public ResultDTO ResponseConst(String key, JSONObject Data){
        ResultDTO resultDTO = getByKey(key);
        resultDTO.setData(Data);
        return resultDTO;
    }

}
